package com.facebook.Events 
{
	import com.facebook.data.FacebookData;
	import com.facebook.errors.FacebookError;

	import flash.events.Event;

	/**
	 * @author Ben Smith
	 */
	public class FacebookEvent extends Event 
	{
		public static const PERMISSIONS_LOADED : String = "permissionsLoaded";
		public static const LOGOUT : String = "logout";
		public static const CONNECT : String = "connect";
		public static const VERIFYING_SESSION : String = "verifyingSession";
		public static const WAITING_FOR_LOGIN : String = "waitingForLogin";
		public static const PERMISSION_CHANGE : String = "permissionChanged";
		public static const PERMISSION_STATUS : String = "permissionStatus";
		public static const LOGIN_SUCCESS : String = "loginSuccess";
		public static const ERROR : String = "facebookEventError";
		public static const PERMISSIONS_WINDOW_SHOW : String = "permissionsWindowShow";
		public static const LOGIN_FAILURE : String = "loginFailure";
		public static const LOGIN_WINDOW_SHOW : String = "loginWindoShow";
		public static const COMPLETE : String = "complete";

		public var success : Boolean;
		public var error : FacebookError;
		public var hasPermission : Boolean;
		public var data : FacebookData;
		public var permission : String;

		function FacebookEvent(type : String, bubbles : Boolean = false, cancelable : Boolean = false, success : Boolean = false, data : FacebookData = null, error : FacebookError = null) : void
		{
			super(type, bubbles, cancelable)
			this.success = success
			this.error = error
			this.data = data
		}

		public override function clone() : Event 
		{ 
			return new FacebookEvent(type, bubbles, cancelable, success, data, error);
		} 

		public override function toString() : String 
		{ 
			return formatToString("FacebookEvent", "type", "bubbles", "cancelable", "success", "data", "error"); 
		}
	}
}
